#include<iostream>
#include<vector>
#include<stack>
using namespace std;

class MyQueue {
public:
	MyQueue() {
		
	}

	void push(int x) {
		saver.push(x);
	}

	int pop() {
		while (!saver.empty())
		{
			int x = saver.top();
			loader.push(x);
			saver.pop();
		}
		int res = loader.top();
		loader.pop();
		while(!loader.empty())
		{
			int x = loader.top();
			saver.push(x);
			loader.pop();			
		}
		return res;
	}

	int peek() {
		while(!saver.empty())
		{
			int x = saver.top();
			loader.push(x);
			saver.pop();
		}
		int res = loader.top();
		while(!loader.empty())
		{
			int x = loader.top();
			saver.push(x);
			loader.pop();
		}
		return res;
	}

	bool empty() {
		return saver.size() == 0 ? true : false;
	}
private:
	stack<int> saver;
	stack<int> loader;
};



void main() {
	MyQueue myQueue;
	myQueue.push(1);
	myQueue.push(2);
	myQueue.push(3);
	myQueue.push(4);
	int y=myQueue.pop();
	myQueue.push(5);
	int y1 = myQueue.pop();
	int y2 = myQueue.pop();
	int y3 = myQueue.pop();
	int y4 = myQueue.pop();
	cout << "Done" << endl;
}